package com.example.itext.PDF中创建列表;

import com.itextpdf.text.*;
import com.itextpdf.text.pdf.PdfWriter;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class ITEXT {
    public static void main(String[] args) throws FileNotFoundException, DocumentException {

        Document document = new Document();

        PdfWriter pdfWriter = PdfWriter.getInstance(document,new FileOutputStream("D:\\javaIdea\\IDEAPDF\\创建列表.pdf"));

        document.open();

        document.add(new Paragraph("list"));

        // 创建一个有序列表
        List list = new List(List.ORDERED);
        list.add(new ListItem("a"));
        list.add(new ListItem("b"));
        list.add(new ListItem("c"));
        list.add(new ListItem("d"));

        document.add(list);

        document.close();

        pdfWriter.close();

    }
}
